package com.candy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

@Controller
@RequestMapping("hello")
public class HelloController {

    @RequestMapping("show1")
    public ModelAndView show1() {
       ModelAndView mv=new ModelAndView();
       mv.setViewName("hello");
       mv.addObject("msg","这是我的第一个SpringMVC程序。。。。。"+new Date().toLocaleString());
        return mv;
    }
//    返回值为String类型返回的仍然是视图名字
    @RequestMapping("show2")
    public String show2() {
              return "hello";
    }
}
